﻿namespace EyeOpen.Data.EntityFramework
{
	using System.Data.Entity;

	public abstract class EfUnitOfWork
		: DbContext, IUnitOfWork
	{
		public IDatabase Db
		{
			get
			{
				return new DatabaseWrapper(this);
			}
		}

		public IRepository<T> Repository<T>() 
			where T : class
		{
			return new Repository<T>(Set<T>());
		}

		public void Commit()
		{
			SaveChanges();
		}
	}
}